import { EnumplatFrom } from "../../../../Core/Sdk/EnumplatFrom";
import SdkTool from "../../../../Core/Sdk/SdkTool";
import ModuleWindow from "../../window/ModuleWindow";
import AbstractScene from "../AbstractScene";
import * as fgui from "fairygui-cc";
import WindowObject from "../../window/WindowObject";
import ConfigManager from "../../../Config/ConfigManager";
import { LocalizationManager } from "../../../../Core/Language/LocalizationManager";
import { resources } from "cc";
import UICore from "../../../../Core/Res/UICore";
import Log from "../../../../Core/Log/Log";

export class SceneLogin extends AbstractScene {
    protected init(): void {
        super.init();
    }
    public enterScene(): void {
        Log.ins.log(1, "进入登录场景,开始加载登录界面资源");
        this.onSceneEntered();
        let res = [
            "UI/Start",
            "UI/Start_atlas0",
        ];
        resources.load(res, (err, assets) => {
            Log.ins.log(1, "登录界面资源加载完成，显示登录页");
            UICore.addPackage(`Start`);
            this.onUILoaded();
        });
    }
    onUILoaded() {
        switch (SdkTool.ins.platform) {
            case EnumplatFrom.TT:
                ModuleWindow.ins.openView(WindowObject.ins.TtStartView);
                break;
            case EnumplatFrom.WX:
                ModuleWindow.ins.openView(WindowObject.ins.WxStartView);
                break;
            default:
                ModuleWindow.ins.openView(WindowObject.ins.BaseStartView);
                break;
        }

    }
    exitScene(): void {
        this.onSceneExited();
    }
} 